{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=119
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	i,n,kk,ls,ans,j:longint;
	s:string;
	f:boolean;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
ans:=0;
for i:=1 to n do begin
	s:=inttostr(i);
	ls:=length(S);
	kk:=ls div 2;
	f:=true;
	for j:=1 to kk do 
		if s[j]<>s[ls+1-j] then begin
			f:=false;
			break;
		end;
	if f then inc(ans);
end;
write(ans);
end.